# -*- coding: utf-8 -*-

import urllib.request
import urllib.error

my_url_1 = urllib.request.urlopen("https://www.runoob.com/")
print(my_url_1.getcode())
# 200

try:
    my_url_2 = urllib.request.urlopen("https://www.runoob.com/no.html")
except urllib.error.HTTPError as e:
    if e.code == 404:
        print(404)